package com.test.testauth.controller;

import com.test.testauth.Vo.AjaxResult;
import com.test.testauth.Vo.InstructDTO;
import com.test.testauth.Vo.InstructParam;
import com.test.testauth.service.UavNestCentralService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;

/**
 * @author ：wang qiang
 * @date ：Created 2024/8/1 19:14
 * @description：无人机与机巢指令统一接口
 */
@Controller
@RequestMapping("instruct")
public class UavNestInstructController {
    @Resource
    private UavNestCentralService uavNestCentralService;

    /**无人机接口**/
    @ResponseBody
    @PostMapping("uav")
    public AjaxResult<InstructDTO> sendInstructToUav(@RequestBody InstructParam param){
        //加密的目的是 尽可能的让其他人不知道接口在做什么操作
        //前端加密
        //后端解密
        //返回参数加密
        //返回参数解密
        return uavNestCentralService.UavSendInstruct(param);
    }
    /**机巢接口**/
    @ResponseBody
    @PostMapping("nest")
    public AjaxResult<InstructDTO> sendInstructToNest(@RequestBody InstructParam param){
        //加密的目的是 尽可能的让其他人不知道接口在做什么操作
        //前端加密
        //后端解密
        //返回参数加密
        //返回参数解密
        return uavNestCentralService.NestSendInstruct(param);
    }
}
